<?php


    if (!empty($_POST)) {


        //print_r($_POST);die;

        $username = $_POST['username'];
        $password = md5($_POST['password']);
        $email = $_POST['email'];
        $level = $_POST['level'];

        $sql = "insert into `admin` (`username`,`password`,`email`,`level`) values ('$username','$password','$email','$level')";

        mysqli_query($link,$sql);
        $_rows = mysqli_affected_rows($link);
        if ($_rows > 0) {
            echo '<script type="text/javascript">alert("添加成功！");self.location.href="index.php?c=admin&a=list&admin=1";</script>';die;
        }else{
            echo '<script type="text/javascript">alert("添加失败！");history.go(-1);</script>';die;
        }
    }




?>